(function(){
	var isJson = function(obj) {
		try {
			obj = JSON.parse(obj);
	　　 } catch(error) {
		    obj = obj;
	　　 }
	    var isjson = typeof(obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
	    return isjson;
	}
	
	var jsonToString = function(json) {
		json = JSON.stringify(json, function(key, val) {
		    if (typeof val === 'function') {
			    return val + '';
			}
			return val;
		});
		return json;
	}
	var stringToJson = function(json) {
		json = JSON.parse(json,function(key,val){
			if (val.indexOf&&val.indexOf('function')>-1) {
		    	return eval("(function(){return "+val+" })()")
		    }
		    return val;
        });
		return json;
	}
	
	window.isJson = isJson;
	window.jsonToString = jsonToString;
	window.stringToJson = stringToJson;
}())


